<link rel="stylesheet" href="<?php echo STATIC_URL.'backend/css/notice.css'?>" />
<script>
function closeFancy(){
    parent.jQuery.fancybox.close();
}
function sendAjax(){
    var timeLimit = $("#datetimepicker_dark").val();
    if(timeLimit == ""){
        alert("Vui lòng chọn thông tin");$("#datetimepicker_dark").focus();return false;
    }
    $("#submit").attr('disabled','disabled');
    $("#cancel").attr('disabled','disabled');
    $("#success").html("<img src='<?php echo STATIC_URL;?>/backend/images/icon/loading-2.gif' /> <br/> Vui lòng chờ");
    setTimeout(function () {
        $.ajax(
            {
                url : '/auth/bookingStatus/timeLimit',
                type: "POST",
                data : { timeLimit:timeLimit,id:$("#id").val()},
                cache: true,
                beforeSend: function(){
                    $("#success").html("<img src='<?php echo STATIC_URL;?>/backend/images/icon/loading-2.gif' /> <br/> Đang xử lí");
                },
                success:function(data)
                {
                    setTimeout(function () {
                        if(data==0){
                            $("#success").html("<?php echo $this->lang->line("update_successful");?>");
                            setTimeout(function () {
                                closeFancy();
                            },2000);
                            
                        } else {
                            $("#success").html("Thao tác thất bại!");
                        }
                    },2000);
                },
                error: function() 
                {
                    $("#success").html("Thao tác thất bại!");
                }
            });
     },2000);
    
    
}
</script>
<div id="container2">
    <h3 id="nav2" class="logo">
        <a id="logo">&nbsp;</a>
    </h3>
    <div id="wufoo-mz9i3ib0wkzqls">
        <ul style="text-align: center;">
            <li style="font-weight: bold;font-size: 18px;">KHỞI TẠO TIME LIMIT</li>
            <li><br/><?php echo form_input(array('name' => 'timeLimit', 'id' => 'datetimepicker_dark', 'value' => '','placeholder'=>'Vui lòng chọn thời điểm','required'=>'required'));?></li>
        </ul>
        <div class="top-button">
            <?php echo form_button(array('id' => 'submit', 'name' => 'submit', 'content' => $this->lang->line('continue'),'class' => 'btn btn-primary','onclick'=>'sendAjax()')); ?>
            <?php echo form_button(array('id' => 'cancel','content' => $this->lang->line('close'),'class' => 'btn','onclick'=>'closeFancy()')); ?>
        </div>
        <?php echo form_input(array('type'=>'hidden', 'name' => 'id', 'id' => 'id', 'value' => $info->id));?>
        <div id="success"></div>
    </div>
</div>
<?php $this->load->view('templates/backend/datetimepicker'); ?>
<script>
    $(function() {
            $("#datetimepicker_dark").datetimepicker({ theme:'dark',format:'d-m-Y H:i:s' });
    });
</script>